swap first and last digit of a number in python